﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using PetroMentor.Service;
using HSE.Common;
using DIST.LR.ZHJG.Events;
using HSE.Events;
using PetroMentor.Service.Entities;

namespace HSE
{
    public partial class AqxsManage : UserControl
    {
        public AqxsManageViewModel viewmodel;
        Storyboard sbshow, sbhidden;

        public AqxsManage()
        {
            InitializeComponent();

            sbshow = this.Resources["showAttachmentBorder"] as Storyboard;
            sbhidden = this.Resources["hiddenAttachmentBorder"] as Storyboard;
            viewmodel = new AqxsManageViewModel();
            this.DataContext = viewmodel;

            EventAggregatorRepository.EventAggregator.GetEvent<QueryEvent<T_WHYL_AQXS>>().Subscribe(QueryHandler);
            this.Loaded += new RoutedEventHandler(AqxsManage_Loaded);
        }

        


        public void AqxsManage_Loaded(object sender, RoutedEventArgs e)
        {
            viewmodel.Select(1, 10, "");
        }

        public void QueryHandler(CommonQueryInfo<T_WHYL_AQXS> info)
        {
            gridview.Init(GridMode.Edit, viewmodel.Columns);
            gridview.Binding<T_WHYL_AQXS>(info);
        }

        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            sbhidden.Begin();
        }
    }
}
